<template>
  <div>
   <h1>会员列表增加</h1>
   <table>
    <tbody>
      <tr>
        <td align="right">会员名称</td>
        <td><input type="text" v-model="infor.Name"/></td>
      </tr>

      <tr>
        <td align="right">会员手机号</td>
        <td><input type="text" v-model="infor.Phone"/></td>
      </tr>

      <tr>
        <td align="right">会员身份证</td>
        <td><input type="text" v-model="infor.Card"/></td>
      </tr>

      <tr>
        <td align="right">会员的生日</td>
        <td><input type="date" v-model="infor.Birthday"/></td>
      </tr>

      <tr>
        <td align="right">会员的性别</td>
        <td><input type="radio" name="Add" v-model="infor.Sex"/>男<input type="radio" name="Add" v-model="infor.Sex"/>女</td>
      </tr>
      <tr>
        <td align="right">会员的状态</td>
        <td><input type="radio" name="T" v-model="infor.State"/>1<input type="radio" name="T" v-model="infor.State"/>2</td>
      </tr>
      <tr>
        <td align="right">会员的密码</td>
        <td><input type="password" v-model="infor.Pwd"/></td>
      </tr>
      <tr>
        <td align="right">会员的余额</td>
        <td><input type="text" v-model="infor.Money"/></td>
      </tr>

      <tr>
        <td align="right">会员的积分</td>
        <td><input type="text" v-model="infor.Points"/></td>
      </tr>

      <tr>
        <td align="right">会员添加时间</td>
        <td><input type="date" v-model="infor.CreateTime"/></td>
      </tr>
      <tr>
        <td align="right">会员修改时间</td>
        <td><input type="date" v-model="infor.UpdateTime"/></td>
      </tr>

      <tr>
        <td align="right"></td>
        <td><input type="button" value="添加" @click="add"/></td>
      </tr>
    </tbody>
   </table>
  </div>
</template>

<script setup lang="ts">
import {ref} from 'vue'
import axios from 'axios'

const infor = ref({
  Name: "",
  Phone: "",
  Card: "",
  Birthday: "",
  Sex: 0,
  State: 0,
  Pwd: "",
  Money: "",
  Points: "",
  CreateTime: "",
  UpdateTime: "",
})

const add=()=>{
  axios.post("/api/Member/MemberAdd",{
  Name: infor.value.Name,
  Phone: infor.value.Phone,
  Card: infor.value.Card,
  Birthday: infor.value.Birthday,
  Sex: infor.value.Sex,
  State: infor.value.State,
  Pwd: infor.value.Pwd,
  Money: infor.value.Money,
  Points: infor.value.Points,
  CreateTime: infor.value.CreateTime,
  UpdateTime: infor.value.UpdateTime,
  })
  .then((res)=>{
    console.log(res);
    if(res.data==1)
    {
      alert("添加成功");      
    }
    else{
      alert("添加失败")
    }
  })
}
</script>

<style scoped>

</style>